// AUTO GENERATED CODE!
// CODE GENERATOR WILL NOT PRESERVE MANUAL CHANGES TO THIS CODE!
// 

// MIT License (MIT)
// 
// Copyright (c) 2014 K Ercan Turkarslan
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// 


using System;

namespace Mios.Generated.ServiceFiles
{
    // Generated from S_HVAC_UserOperatingMode1.xml
    
    public class HVAC_UserOperatingMode1Service : MiosService
    {
        #region ModeTarget : String;
        private String _mModeTarget;
        
        public String ModeTarget
        {
            get
            {
                return _mModeTarget ?? GetModeTarget();
            }
        }
        
        #region Action SetModeTarget(String newModeTarget) : String;
        public String SetModeTarget(String newModeTarget)
        {
            if (String.IsNullOrEmpty(newModeTarget))
                throw new ArgumentNullException("newModeTarget");
            
            switch(newModeTarget)
            {
                case "Off":
                case "HeatOn":
                case "CoolOn":
                case "AutoChangeOver":
                case "AuxHeatOn":
                case "EconomyHeatOn":
                case "EmergencyHeatOn":
                case "AuxCoolOn":
                case "EconomyCoolOn":
                case "BuildingProtection":
                case "EnergySavingsMode":
                    break;
                
                default:
                    throw new ArgumentOutOfRangeException("newModeTarget");
            }
            
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetModeTarget",
                String.Format("NewModeTarget={0}", ToLuup(_mModeTarget = newModeTarget)));
        }
        #endregion Action SetModeTarget
        
        #region Action GetModeTarget() : String;
        public String GetModeTarget()
        {
            _mModeTarget = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "ModeTarget"));
            
            return _mModeTarget;
        }
        #endregion Action GetModeTarget
        
        #endregion
        
        #region ModeStatus : String;
        private String _mModeStatus;
        
        public String ModeStatus
        {
            get
            {
                return _mModeStatus ?? GetModeStatus();
            }
        }
        
        #region Action SetModeStatus(String newModeStatus) : String;
        public String SetModeStatus(String newModeStatus)
        {
            if (String.IsNullOrEmpty(newModeStatus))
                throw new ArgumentNullException("newModeStatus");
            
            switch(newModeStatus)
            {
                case "Off":
                case "InDeadBand":
                case "HeatOn":
                case "CoolOn":
                case "AutoChangeOver":
                case "AuxHeatOn":
                case "EconomyHeatOn":
                case "EmergencyHeatOn":
                case "AuxCoolOn":
                case "EconomyCoolOn":
                case "BuildingProtection":
                case "EnergySavingsHeating":
                case "EnergySavingsCooling":
                    break;
                
                default:
                    throw new ArgumentOutOfRangeException("newModeStatus");
            }
            
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetModeStatus",
                String.Format("newModeStatus={0}", ToLuup(_mModeStatus = newModeStatus)));
        }
        #endregion Action SetModeStatus
        
        #region Action GetModeStatus() : String;
        public String GetModeStatus()
        {
            _mModeStatus = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "ModeStatus"));
            
            return _mModeStatus;
        }
        #endregion Action GetModeStatus
        
        #endregion
        
        #region EnergyModeTarget : String;
        private String _mEnergyModeTarget;
        
        public String EnergyModeTarget
        {
            get
            {
                return _mEnergyModeTarget ?? GetEnergyModeTarget();
            }
        }
        
        #region Action SetEnergyModeTarget(String newModeTarget) : String;
        public String SetEnergyModeTarget(String newModeTarget)
        {
            if (String.IsNullOrEmpty(newModeTarget))
                throw new ArgumentNullException("newModeTarget");
            
            switch(newModeTarget)
            {
                case "Normal":
                case "EnergySavingsMode":
                    break;
                
                default:
                    throw new ArgumentOutOfRangeException("newModeTarget");
            }
            
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetEnergyModeTarget",
                String.Format("NewModeTarget={0}", ToLuup(_mEnergyModeTarget = newModeTarget)));
        }
        #endregion Action SetEnergyModeTarget
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetEnergyModeTarget() : String;
        public String GetEnergyModeTarget()
        {
            _mEnergyModeTarget = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "EnergyModeTarget"));
            
            return _mEnergyModeTarget;
        }
        #endregion Action GetEnergyModeTarget
        
        #endregion
        
        #region EnergyModeStatus : String;
        private String _mEnergyModeStatus;
        
        public String EnergyModeStatus
        {
            get
            {
                return _mEnergyModeStatus ?? GetEnergyModeStatus();
            }
        }
        
        #region Action SetEnergyModeStatus(String newEnergyModeStatus) : String;
        public String SetEnergyModeStatus(String newEnergyModeStatus)
        {
            if (String.IsNullOrEmpty(newEnergyModeStatus))
                throw new ArgumentNullException("newEnergyModeStatus");
            
            switch(newEnergyModeStatus)
            {
                case "Normal":
                case "EnergySavingsMode":
                    break;
                
                default:
                    throw new ArgumentOutOfRangeException("newEnergyModeStatus");
            }
            
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetEnergyModeStatus",
                String.Format("newEnergyModeStatus={0}", ToLuup(_mEnergyModeStatus = newEnergyModeStatus)));
        }
        #endregion Action SetEnergyModeStatus
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetEnergyModeStatus() : String;
        public String GetEnergyModeStatus()
        {
            _mEnergyModeStatus = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "EnergyModeStatus"));
            
            return _mEnergyModeStatus;
        }
        #endregion Action GetEnergyModeStatus
        
        #endregion
        
        #region Name : String;
        private String _mName;
        
        public String Name
        {
            get
            {
                return _mName ?? GetName();
            }
        }
        
        #region Action SetName(String newName) : String;
        public String SetName(String newName)
        {
            if (String.IsNullOrEmpty(newName))
                throw new ArgumentNullException("newName");
            
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetName",
                String.Format("NewName={0}", ToLuup(_mName = newName)));
        }
        #endregion Action SetName
        
        #region Action GetName() : String;
        public String GetName()
        {
            _mName = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "Name"));
            
            return _mName;
        }
        #endregion Action GetName
        
        #endregion
        
        
        #region Method SetVariable(String name, String value) : Boolean;
        internal override Boolean SetVariable(String name, String value)
        {
            switch(name)
            {
                case "EnergyModeStatus":
                    _mEnergyModeStatus = FromLuupString(value); return true;
                case "EnergyModeTarget":
                    _mEnergyModeTarget = FromLuupString(value); return true;
                case "ModeStatus":
                    _mModeStatus = FromLuupString(value); return true;
                case "ModeTarget":
                    _mModeTarget = FromLuupString(value); return true;
                case "Name":
                    _mName = FromLuupString(value); return true;
                default:
                    return false;
            }
        }
        #endregion Method SetVariable
        
        public HVAC_UserOperatingMode1Service(MiosEngine engine, UInt32 deviceId, String serviceId)
            : base(engine, deviceId, serviceId)
        {
            
        } //End Constructor
    } //End of class
} //End of Namespace

